package com.fy.spring.config;

import org.springframework.cloud.gateway.route.RouteLocator;
import org.springframework.cloud.gateway.route.builder.RouteLocatorBuilder;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

@Configuration
public class GateWayConfig {

    @Bean
    public RouteLocator customRouteLocator(RouteLocatorBuilder builder) {
        RouteLocatorBuilder.Builder routes = builder.routes();

        routes.route("path_route", r -> r.path("/guonei").uri("http://news.baidu.com"));
        routes.route("path_route1", r -> r.path("/payment/port/**", "/payment/get/**").uri("http://localhost:8001"));
        return routes.build();
    }
}
